package mogiksaop.qliphoth.common.blocks;

import net.minecraft.block.BlockDirt;
import net.minecraft.block.BlockStem;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import mogiksaop.qliphoth.client.core.handler.ModelHandler;
import mogiksaop.qliphoth.common.Qliphoth;
import mogiksaop.qliphoth.common.lib.LibBlockNames;
import mogiksaop.qliphoth.common.lib.LibGuiIDs;

import javax.annotation.Nonnull;
import java.util.Random;

public class BlockSingleNodeCore extends BlockMod {

	public BlockSingleNodeCore() {
		super(Material.IRON, LibBlockNames.SINGLE_NODE_CORE);
		setHardness(5.0F);
		setSoundType(SoundType.METAL);
		this.setHarvestLevel("pickaxe", 2);
		// setTickRandomly(true);
		// setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.ALTGRASS_VARIANT,
		// AltGrassVariant.DRY));
	}

	/*
	 * @Nonnull
	 * 
	 * @Override public BlockStateContainer createBlockState() { return new
	 * BlockStateContainer(this, BotaniaStateProps.ALTGRASS_VARIANT); }
	 */

	/*
	 * @Override public boolean isToolEffective(String type, @Nonnull IBlockState
	 * state) { return type.equals("shovel"); }
	 */

	@Override
	public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
//		ItemStack held = player.getHeldItem(hand);
//		if(held.getItem() instanceof ItemHoe && world.isAirBlock(pos.up())) {
//			held.damageItem(1, player);
//			world.setBlockState(pos, Blocks.FARMLAND.getDefaultState(), 1 | 2);
//			return true;
//		}

		if (!world.isRemote) {
			player.openGui(Qliphoth.instance, LibGuiIDs.SINGLE_CORE, world, pos.getX(), pos.getY(), pos.getZ());
			return true;
		}

		return false;
	}

	/*
	 * @Nonnull
	 * 
	 * @Override public Item getItemDropped(IBlockState state, Random rand, int
	 * fortune) { return Blocks.DIRT.getItemDropped(state, rand, fortune); }
	 * 
	 * @Nonnull
	 * 
	 * @Override public ItemStack getPickBlock(@Nonnull IBlockState state,
	 * RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos,
	 * EntityPlayer player) { return new ItemStack(this, 1,
	 * getMetaFromState(world.getBlockState(pos))); }
	 */

	/*
	 * @SideOnly(Side.CLIENT)
	 * 
	 * @Override public void registerModels() {
	 * ModelHandler.registerBlockToState(this, AltGrassVariant.values().length); }
	 */
}
